package me.ereach.streams;

import java.util.List;
import java.util.stream.Collectors;

public class Main14PartitionElements {
    public static void main(String[] args) {
        List<Movie> movies = List.of(
                new Movie("a", 10, Genre.THRILLER),
                new Movie("b", 15, Genre.ACTION),
                new Movie("c", 20, Genre.ACTION)
        );

        var rst = movies.stream()
                .collect(Collectors.partitioningBy(
                        m -> m.getLikes() >= 15,
                        Collectors.mapping(Movie::getTitle,
                                Collectors.joining(", "))));

        System.out.println(rst);
    }
}
